/*
 * Copyright (c) 2023 Huawei Device Co., Ltd.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#ifndef COMMON_H_
#define COMMON_H_

#include <stddef.h>
#include <stdint.h>
#include <stdio.h>
#include <openssl/objects.h>
#include <openssl/pem.h>
#include <openssl/ossl_typ.h>
#include <openssl/x509.h>
#include <openssl/x509v3.h>

#define HCF_MAX_STR_LEN 1024 // input string parameter max length limit, include \0

typedef struct CfBlob CfBlob;
struct CfBlob
{
	uint32_t size;
	uint8_t *data;
};

enum CfEncodingFormat
{
	CF_FORMAT_DER = 0,
	CF_FORMAT_PEM = 1,
};

typedef struct
{
	uint8_t *data;
	size_t len;
	enum CfEncodingFormat encodingFormat;
} CfEncodingBlob;

typedef struct
{
	CfBlob *data;
	enum CfEncodingFormat format;
	uint32_t count;
} CfArray;

typedef struct
{
	CfBlob *data;
	uint32_t count;
} CfBlobArray;

#ifdef __cplusplus
extern "C"
{
#endif

#ifdef __cplusplus
}
#endif

#endif
